package com.ship.contract.bean.decisionAnalysis;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ship.common.core.base.Joinable;
import com.ship.common.core.mapping.Label;
import com.ship.common.core.mapping.SearchItem;
import com.ship.common.core.mapping.TableColumn;
import com.ship.contract.utils.NumberFormatUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ship.common.core.base.BaseBean;

import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sm_ship_rent")
public class SmShipRent extends BaseBean implements Joinable {
    /**
     * DATE 所属周，如 1 月 2 日，WEEK=1，1 月 10 日，WEEK=2
     */
    @Label(value = "WEEK")
    @SearchItem
    @TableColumn
    @TableField("rent_week")
    @ApiModelProperty(value = "rent_date 所属周，如 1 月 2 日，WEEK=1，1 月 10 日，WEEK=2")
    private Integer rentWeek;

    /**
     * 默认是上传的时间，支持用户进行编辑
     */
    @Label(value = "DATE")
    @SearchItem
    @TableColumn
    @TableField("rent_date")
    @ApiModelProperty(value = "上传的时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date rentDate;

    /**
     * 航运机构
     */
    @Label(value = "Brokers")
    @SearchItem
    @TableColumn
    @TableField("broker")
    @ApiModelProperty(value = "航运机构")
    private String broker;

    @TableField(exist = false)
    private String brokerListForSearch;

    /**
     * 船型：舱容+船舶的主机类型
     */
    @Label(value = "VESSEL TYPE", enumContent = "船舶租金VesselType",multiSelect = true)
    @TableField("vessel_type")
    @ApiModelProperty(value = "船型")
    private Integer vesselType;

    @Label(value = "VESSEL TYPE")
    @SearchItem
    @TableColumn
    @TableField(exist = false)
    private String vesselTypeStr;

    @TableField(exist = false)
    private String vesselTypeListForSearch;

    @Label(value = "Spot-West")
    @TableField("spot_west")
    @ApiModelProperty(value = "西航线租金")
    private BigDecimal spotWest;

    @Label(value = "Spot-West")
    @TableColumn
    @TableField(exist = false)
    private String spotWestStr;

    @Label(value = "Spot-East")
    @TableField("spot_east")
    @ApiModelProperty(value = "东航线租金")
    private BigDecimal spotEast;

    @Label(value = "Spot-East")
    @TableColumn
    @TableField(exist = false)
    private String spotEastStr;

    @Label(value = "Spot-Middle-East")
    @TableField("spot_middle_east")
    @ApiModelProperty(value = "中东航线租金")
    private BigDecimal spotMiddleEast;

    @Label(value = "Spot-Middle-East")
    @TableColumn
    @TableField(exist = false)
    private String spotMiddleEastStr;

    @Label(value = "6 Months")
    @SearchItem
    @TableField("rent_six_month")
    @ApiModelProperty(value = "租期为 6 个月的日租金")
    private BigDecimal rentSixMonth;

    @Label(value = "6 Months")
    @TableColumn
    @TableField(exist = false)
    private String rentSixMonthStr;

    @Label(value = "12 Months")
    @SearchItem
    @TableField("rent_twelve_month")
    @ApiModelProperty(value = "租期为 12 个月的日租金")
    private BigDecimal rentTwelveMonth;

    @Label(value = "12 Months")
    @TableColumn
    @TableField(exist = false)
    private String rentTwelveMonthStr;

    @Label(value = "36 Months")
    @SearchItem
    @TableField("rent_thirty_six_month")
    @ApiModelProperty(value = "租期为 36 个月的日租金")
    private BigDecimal rentThirtySixMonth;

    @Label(value = "36 Months")
    @TableColumn
    @TableField(exist = false)
    private String rentThirtySixMonthStr;

    @Label(value = "5 Years")
    @SearchItem
    @TableField("rent_sixty_month")
    @ApiModelProperty(value = "租期为 36 个月的日租金(5年)")
    private BigDecimal rentSixtyMonth;

    @Label(value = "5 Years")
    @TableColumn
    @TableField(exist = false)
    private String rentSixtyMonthStr;

    @Label(value = "10 Years")
    @SearchItem
    @TableField("rent_hundred_twenty_month")
    @ApiModelProperty(value = "租期为 120 个月的日租金(10年)")
    private BigDecimal rentHundredTwentyMonth;

    @Label(value = "10 Years")
    @TableColumn
    @TableField(exist = false)
    private String rentHundredTwentyMonthStr;

    @Label(value = "操作时间")
    @TableColumn
    @TableField("update_date")
    @ApiModelProperty(value = "操作时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateDate;

    @Label(value = "操作人")
    @TableColumn
    @TableField("update_by")
    @ApiModelProperty(value = "操作人")
    private String updateBy;

    @Label(value = "报告时间")
    @TableColumn
    @TableField("rent_report_date")
    @ApiModelProperty(value = "报告时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date rentReportDate;

    @Label(value = "备注")
    @TableColumn
    @TableField("remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Override
    public String getLabel() {
        return null;
    }

    @Override
    public String getValue() {
        return null;
    }

    public String getVesselTypeStr() {
        String result = null;
        if (getVesselType() != null) {
            Integer type = getVesselType();
            if (type == 1) {
                result = "138-150k ST";
            }
            if (type == 2) {
                result = "155-165k TFDE";
            }
            if (type == 3) {
                result = "174k 2-Stroke/MEGI/XDF";
            }
        }
        return result;
    }

    public String getRentSixMonthStr(){
        String result = null;
        if (getRentSixMonth() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getRentSixMonth());
        }
        return result;
    }

    public String getRentTwelveMonthStr(){
        String result = null;
        if (getRentTwelveMonth() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getRentTwelveMonth());
        }
        return result;
    }

    public String getRentThirtySixMonthStr(){
        String result = null;
        if (getRentThirtySixMonth() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getRentThirtySixMonth());
        }
        return result;
    }

    public String getRentSixtyMonthStr(){
        String result = null;
        if (getRentSixtyMonth() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getRentSixtyMonth());
        }
        return result;
    }

    public String getRentHundredTwentyMonthStr(){
        String result = null;
        if (getRentHundredTwentyMonth() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getRentHundredTwentyMonth());
        }
        return result;
    }

    public String getSpotWestStr(){
        String result = null;
        if (getSpotWest() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getSpotWest());
        }
        return result;
    }

    public String getSpotEastStr(){
        String result = null;
        if (getSpotEast() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getSpotEast());
        }
        return result;
    }

    public String getSpotMiddleEastStr(){
        String result = null;
        if (getSpotMiddleEast() != null) {
            result = "$" + NumberFormatUtil.numericFormatting(getSpotMiddleEast());
        }
        return result;
    }
}
